<template>
    <view>
        <view class="p-4 flex flex-column grid-gap-4">
            <view class="p-4 bg-white rounded-4 flex flex-column flex-center grid-gap-4">
                <x-input-number v-model="form.num" :max="99" unit="个" size="h1" show gap="6"></x-input-number>
            </view>

            <view class="flex">
                <button class="flex-1 btn-primary btn-round" @click="submit()">提交</button>
            </view>
        </view>

        <!-- 选择意向城市 -->
        <x-loading v-if="loading" />
    </view>
</template>

<script setup lang="ts">
import { ref, } from 'vue';
import { $api, $message, $page } from '@/utils';
import { onLoad } from '@dcloudio/uni-app';
const form = ref({
    num: '',
});
const loading = ref(false);
const submit = () => {
    if (loading.value) return;
    loading.value = true;
    $api.Salesman.createEmptyQrcode(form.value).then((res: any) => {
        $message.success('创建成功');
        $page.redirect('/salesman/pages/people/index', true);
    }).catch((err: any) => {
        $message.error(err.msg);
    }).finally(() => {
        loading.value = false;
    })
}
onLoad((options: any) => {
})
</script>
